package com.zsd.android.apteventbus.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import com.zsd.android.apteventbus.utils.MLog;

public class ThreadService extends Service {

    public ThreadService() {
    }

    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
        return null;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        MLog.i("onStart");
        tink();
        MLog.i("after runnable");
        return super.onStartCommand(intent, flags, startId);
    }

    private void tink() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10000; i++) {
                    try {
                        MLog.i("runnable i = " + i);
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }
}
